package com.chaofan.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
public class Resrful {

    //@RequestMapping(value = "/add/{a}/{b}", method = RequestMethod.DELETE)
    @GetMapping("/add/{a}/{b}")
    public String test1(@PathVariable int a,@PathVariable int b, Model model) {
        int res = a+b;
        model.addAttribute("msg", "结果1是"+res);
        return "hello";
    }

    @PostMapping("/add/{a}/{b}")
    public String test2(@PathVariable int a,@PathVariable int b, Model model) {
        int res = a+b;
        model.addAttribute("msg", "结果2是"+res);
        return "hello";
    }
}
